<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="../../css/backstage.css" type="text/css"/>
    <title>JpetStore后台管理</title>
</head>
<body>
<div th:replace="/administrator/common/head.html"></div>
<div class="mid">
    <div class="title">
        商品总览
    </div>
    <table>
        <tr>
            <td>宠物ID</td>
            <td>产品ID</td>
            <td>种类</td>
            <td>单价</td>
            <td>库存</td>
            <td>商品状态</td>
            <td>产品描述</td>
            <td>编辑或者删除</td>
        </tr>
        <tr th:each="item:${AdminitemList}">
            <td th:text="${item.getItemId()}"></td>
            <td th:text="${item.getProduct().getProductId()}"></td>
            <td th:text="${item.getProduct().getCategoryId()}"></td>
            <td>
                <input th:value="${item.getListPrice()}" type="text" readonly="readonly" style="width: 70px">
            </td>
            <td>
                <input th:value="${item.getSupplierId()}" type="text" readonly="readonly" style="width: 70px">
            </td>
            <td>
                <select name="status" th:id="${item.getItemId()}" disabled="disabled">
                </select>
                <script th:inline="javascript">
                    /*<![CDATA[*/
                    var status1 = document.getElementById(/*[[${item.getItemId()}]]*/)
                    if("P" == /*[[${item.getStatus()}]]*/){
                        var opt = document.createElement("option");
                        opt.value="P";
                        opt.innerHTML="出售";
                        opt.selected=true;
                        status1.appendChild(opt);
                        var opt1 = document.createElement("option");
                        opt1.value="NP";
                        opt1.innerHTML="暂不出售";
                        status1.appendChild(opt1);
                    }
                    else{
                        var opt = document.createElement("option");
                        opt.value="P";
                        opt.innerHTML="出售";
                        status1.appendChild(opt);
                        var opt1 = document.createElement("option");
                        opt1.value="NP";
                        opt1.innerHTML="暂不出售";
                        opt1.selected=true;
                        status1.appendChild(opt1);
                    }
                    /*]]>*/
                </script>
            </td>
            <td>
                <input th:value="${item.getAttribute1()}" type="text" readonly="readonly" style="width: 120px">
            </td>
            <td>
                <a th:href="@{'/catalog/editItem?itemId='+${item.getItemId()}}">编辑</a>

            </td>
        </tr>

    </table>
</div>
<div th:replace="/administrator/common/foot.html"></div>
</body>
</html>